import { createRouter, createWebHistory } from 'vue-router'
import PatientView from '../views/PatientView.vue'
import NotFound from "../views/NotFound.vue";

const routes = [
    {
        path: '/',
        component: PatientView,
        redirect: '/index',
        children: [
            {
                path: '/index', component: () => import('../views/patient/IndexView.vue')
            },
            {
                path: '/patient',
                component: () => import('../views/patient/AppointmentView.vue'),
                redirect: '/patient/appointment',
                children: [
                    {
                        path: '/patient/appointment', component: () => import('@/views/patient/appointment/AppointmentView.vue')
                    },
                    {
                        path: '/patient/newAppointment', component: () => import('@/views/patient/appointment/NewAppointmentView.vue')
                    },
                    {
                        path: '/patient/information', component: () => import('@/views/patient/information/InformationView.vue')
                    },
                    {
                        path: '/patient/changePatient', component: () => import('@/views/patient/information/ChangePatientView.vue')
                    },
                ]
            },
            {
                path: '/HospitalIndex',component:()=>import('../views/patient/HospitalIndex.vue')
            },
            {
                path: '/DepartmentDetails',component: () => import('../views/patient/DepartmentDetailsView.vue')
            },
            {
                path: '/Doctors',component: () => import('../views/patient/Doctors.vue')
            },
            {
                path: '/Departments',component: () => import('../views/patient/Departments.vue')
            },
            {
                path: '/login',
                component: ()=> import('../views/patient/LoginView.vue'),
                redirect: '/patient/login',
                children:[
                    {
                        path: '/patient/login',
                        component: () => import('../views/patient/login/LoginView.vue')
                    }, {
                        path: '/patient/reg',
                        component: () => import('../views/patient/login/RegView.vue')
                    }, {
                        path: '/patient/forgotPassword',
                        component: () => import('../views/patient/login/ForgotPasswordView.vue')
                    }, {
                        path: '/patient/changePassword',
                        component: () => import('../views/patient/login/ChangePasswordView.vue')
                    }
                ]
            },
        ]
    },
    {
        path: '/admin',
        component: () => import('../views/AdminView.vue'),
        redirect: '/admin/home',
        children: [
            {
                path: '/admin/appointment', component: () => import( '../views/admin/AppointmentView.vue')
            }, {
                path: '/admin/department', component: () => import( '../views/admin/DepartmentView.vue')
            }, {
                path: '/admin/doctor', component: () => import( '../views/admin/DoctorView.vue')
            }, {
                path: '/admin/home', component: () => import( '../views/admin/HomeView.vue')
            }, {
                path: '/admin/patient', component: () => import( '../views/admin/PatientView.vue')
            }, {
                path: '/admin/schedule', component: () => import( '../views/admin/ScheduleView.vue')
            },{
                path: '/admin/formPatient',
                component: () => import('../views/admin/FormPatientView.vue'),
                redirect: '/admin/formPatient/situation',
                children: [
                    {
                        path: '/admin/formPatient/situation',
                        component: () => import('../views/admin/patient/SituationView.vue'),
                    },{
                        path: '/admin/formPatient/basic',
                        component: () => import('../views/admin/patient/BasicView.vue')
                    }
                ]
            },{
                path: '/add',
                component: () => import('../views/admin/AddView.vue'),
                children: [
                    {
                        path: '/newSchedule',
                        component:()=>import('../views/admin/add/NewScheduleView.vue')
                    }, {
                        path: '/newDoctor',
                        component: () => import('../views/admin/add/NewDoctorView.vue')
                    }, {
                        path: '/newDepartment',
                        component: () => import('../views/admin/add/NewDepartmentView.vue')
                    },{
                        path: '/newAppointment',
                        component: () => import('../views/admin/add/NewAppointmentView.vue')
                    },{
                        path: '/admin/changePatient',
                        component: () => import('../views/admin/patient/ChangePatientView.vue')
                    }
                ]
            },
        ]
    },
    {
        path: '/doctor',
        component: () => import('../views/DoctorView.vue'),
        redirect: '/doctor/home',
        children: [
            {
                path: '/doctor/home',
                component: () => import('../views/doctor/HomeView.vue')
            }, {
                path: '/doctor/appointment',
                component: () => import('../views/doctor/AppointmentView.vue')
            }, {
                path: '/doctor/department',
                component: () => import('../views/doctor/DepartmentView.vue')
            }, {
                path: '/doctor/patient',
                component: () => import('../views/doctor/PatientView.vue')
            }, {
                path: '/doctor/schedule',
                component: () => import('../views/doctor/ScheduleView.vue')
            },
        ]
    }, {
        path: '/:notfound(.*)',
        component: NotFound,
    }
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
